import React from "react";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import SupplierHome from "../screens/suppiler/SupplierHome";
import SearchScreen from "../screens/suppiler/SearchScreen";
import SuppilerAdd from "../screens/suppiler/SuppilerAdd";
import SuppilerDetail from "../screens/suppiler/SuppilerDetail";
import SearchDetail from "../screens/suppiler/SearchDetail";
import { HistoryProvider } from "../context/suppiler/historyContext";
import MaterialAdd from "../screens/suppiler/MaterialAdd";
import { MaterialProvider } from "../context/suppiler/materialContext";
import { ComMaterialProvider } from "../context/suppiler/comMaterialContext";
import { GoodsProvider } from "../context/suppiler/goodsContext";
const Stack = createNativeStackNavigator();

const SupplierNavigation = () => {
  return (
    <ComMaterialProvider>
      <MaterialProvider>
        <GoodsProvider>
          <HistoryProvider>
            <Stack.Navigator>
              <Stack.Screen
                name="SupplierHome"
                component={SupplierHome}
                options={{ headerShown: false }}
              />
              <Stack.Screen
                name="SearchScreen"
                component={SearchScreen}
                options={{ headerShown: false }}
              />
              <Stack.Screen
                name="SuppilerAdd"
                component={SuppilerAdd}
                options={({ route }) => ({
                  title: route.params.title,
                  headerStyle: {
                    backgroundColor: "#F2F2F2",
                  },
                })}
              />
              <Stack.Screen
                name="SuppilerDetail"
                component={SuppilerDetail}
                options={{
                  title: "商品详情",
                  headerStyle: {
                    backgroundColor: "#F2F2F2",
                  },
                }}
              />

              <Stack.Screen
                name="MaterialAdd"
                component={MaterialAdd}
                options={{ headerShown: false }}
              />
              <Stack.Screen
                name="SearchDetail"
                component={SearchDetail}
                options={{ headerShown: false }}
              />
            </Stack.Navigator>
          </HistoryProvider>
        </GoodsProvider>
      </MaterialProvider>
    </ComMaterialProvider>
  );
};

export default SupplierNavigation;
